<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        
        
        
        <link rel="shortcut icon" href="../../img/favicon.ico">
        <title>ESPurna项目 - IOTTS</title>
        <link href="../../css/bootstrap.min.css" rel="stylesheet">
        <link href="../../css/font-awesome.min.css" rel="stylesheet">
        <link href="../../css/base.css" rel="stylesheet">
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/styles/docco.min.css">

        <script src="../../js/jquery-1.10.2.min.js" defer></script>
        <script src="../../js/bootstrap.min.js" defer></script>
        <script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.12.0/highlight.min.js"></script>
        <script>hljs.initHighlightingOnLoad();</script> 
    </head>

    <body>
        <div class="navbar fixed-top navbar-expand-lg navbar-dark bg-primary">
            <div class="container">
                <a class="navbar-brand" href="../..">IOTTS</a>
                <!-- Expander button -->
                <button type="button" class="navbar-toggler" data-toggle="collapse" data-target="#navbar-collapse">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <!-- Expanded navigation -->
                <div id="navbar-collapse" class="navbar-collapse collapse">
                        <!-- Main navigation -->
                        <ul class="nav navbar-nav">
                            <li class="navitem">
                                <a href="../.." class="nav-link">首页</a>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">产品 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">USB类</a>
    <ul class="dropdown-menu">
            
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">USBHUB</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-4口</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-7口</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-25口(全通)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-25口(单通)</a>
</li>
    </ul>
  </li>
            
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">USB转PCIE</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-4口</a>
</li>
    </ul>
  </li>
            
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">USB转SATA</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-4口</a>
</li>
    </ul>
  </li>
            
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">USB转TTL</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">USBHUB-4口</a>
</li>
    </ul>
  </li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">物联网控制类</a>
    <ul class="dropdown-menu">
            
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">智能开关</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">智能开关(WIFI-1-LINE)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">智能开关(WIFI-8-LINE)</a>
</li>
    </ul>
  </li>
            
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">智能灯泡</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">智能灯泡(WIFI-1-COLOR)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">智能灯泡(WIFI-RGB)</a>
</li>
    </ul>
  </li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">智能网关</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">远程定位</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">传感器类</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">烟雾传感器</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">天然气检测传感器</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">人体感应传感器</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">亮度检测传感器</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">温湿度检测传感器</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">PM2.5检测传感器</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">雨水检测传感器</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">工业控制</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">冗余电源报警器(RS232通信方式)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">工业继电器控制板(PLC)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">电源开关控制板(MOS)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">工业温控器(温湿度)</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">工业温度采集器(低功耗)</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">模块类</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../../products/canbus_module/" class="dropdown-item">CAN总线模块</a>
</li>
            
<li>
    <a href="../../products/lora/" class="dropdown-item">LORA模块</a>
</li>
            
<li>
    <a href="../../products/%E6%95%B0%E7%A0%81%E7%AE%A1%E6%98%BE%E7%A4%BA%E6%A8%A1%E5%9D%97/" class="dropdown-item">数码管显示模块</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">NB模块</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">GPRS模块</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">GPS模块</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">网口模块</a>
</li>
            
<li>
    <a href="../../products/mos_board_io_1_16/" class="dropdown-item">PT100测量模块</a>
</li>
    </ul>
  </li>
                                </ul>
                            </li>
                            <li class="dropdown active">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">开源项目 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">智能家居</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../mqttserver_mosca/" class="dropdown-item">mqtt开源服务器(mosca)</a>
</li>
            
<li>
    <a href="../OpenMQTTGateway/" class="dropdown-item">网关(OpenMQTTGateway)</a>
</li>
            
<li>
    <a href="./" class="dropdown-item active">ESPurna项目</a>
</li>
            
<li>
    <a href="../Tasmota/" class="dropdown-item">Tasmota项目</a>
</li>
            
<li>
    <a href="../test1/" class="dropdown-item">悟空音箱</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">传感器类</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../test1/" class="dropdown-item">温湿度传感器</a>
</li>
    </ul>
  </li>
                                    
  <li class="dropdown-submenu">
    <a href="#" class="dropdown-item">工业控制</a>
    <ul class="dropdown-menu">
            
<li>
    <a href="../test1/" class="dropdown-item">GRBL项目</a>
</li>
    </ul>
  </li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">文档 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
<li>
    <a href="../test1/" class="dropdown-item">洗衣机受控板固件更新说明</a>
</li>
                                </ul>
                            </li>
                            <li class="dropdown">
                                <a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">调试工具 <b class="caret"></b></a>
                                <ul class="dropdown-menu">
                                    
<li>
    <a href="../test1/" class="dropdown-item">串口调试助手</a>
</li>
                                    
<li>
    <a href="../test1/" class="dropdown-item">CAN总线调试下载工具</a>
</li>
                                </ul>
                            </li>
                        </ul>

                    <ul class="nav navbar-nav ml-auto">
                        <li class="nav-item">
                            <a href="#" class="nav-link" data-toggle="modal" data-target="#mkdocs_search_modal">
                                <i class="fa fa-search"></i> Search
                            </a>
                        </li>
                            <li class="nav-item">
                                <a rel="prev" href="../OpenMQTTGateway/" class="nav-link">
                                    <i class="fa fa-arrow-left"></i> Previous
                                </a>
                            </li>
                            <li class="nav-item">
                                <a rel="next" href="../Tasmota/" class="nav-link">
                                    Next <i class="fa fa-arrow-right"></i>
                                </a>
                            </li>
                    </ul>
                </div>
            </div>
        </div>

        <div class="container">
            <div class="row">
                    <div class="col-md-3"><div class="navbar-light navbar-expand-md bs-sidebar hidden-print affix" role="complementary">
    <div class="navbar-header">
        <button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target="#toc-collapse" title="Table of Contents">
            <span class="fa fa-angle-down"></span>
        </button>
    </div>

    
    <div id="toc-collapse" class="navbar-collapse collapse card bg-secondary">
        <ul class="nav flex-column">
            
            <li class="nav-item" data-level="2"><a href="#espurna" class="nav-link">ESPurna简介</a>
              <ul class="nav flex-column">
              </ul>
            </li>
            
            <li class="nav-item" data-level="2"><a href="#_1" class="nav-link">使用方法</a>
              <ul class="nav flex-column">
              </ul>
            </li>
        </ul>
    </div>
</div></div>
                    <div class="col-md-9" role="main">

<h2 id="espurna">ESPurna简介</h2>
<p>今天为大家介绍的是<code>ESPurna</code>固件。其实在之前介绍彩光灯带时，就很想向大家推荐这个固件了。这个固件出色的地方在于其极高的稳定性、漂亮而易用的界面和其极为人性化的一些隐藏设定，另外，可也以接入各类传感器。为什么说适合新手呢？看图就明白了。</p>
<p><img alt="demo.png" src="174838p6usa2qfd2sysi2d.png" /></p>
<p>项目地址：<a href="https://github.com/xoseperez/espurna">https://github.com/xoseperez/espurna</a></p>
<h2 id="_1">使用方法</h2>
<h3 id="_2">固件烧录方法</h3>
<p>以下是无需 Arduino 和 PlatformIO 的刷机方法：</p>
<ol>
<li>
<p>如果你已经刷好了 Tasmota，直接在 Tasmota 的固件更新界面上传下载好的固件 (bin)，重启以后就变成 ESPurna 了！！！！</p>
</li>
<li>
<p>没有 Python 的话需要先安装 Python，请在 https://www.python.org/downloads/windows/ 下载；（安装后须重新启动）</p>
</li>
<li>
<p>打开命令提示符，执行
pip install pyserial</p>
</li>
<li>
<p>下载附件esptool.zip，解压到方便使用的位置。</p>
</li>
<li>
<p>连接开关、编程器和电脑，打开命令提示符，切换到解压到的位置，执行（D:\Downloads\espurna.bin 是固件的地址）：</p>
</li>
</ol>
<pre><code class="py">python esptool.py -b 115200 --port COM3 write_flash --flash_freq 80m --flash_mode dout 0x000000 D:\Downloads\espurna.bin
</code></pre>

<p>等待烧写完成</p>
<p>如果刷机后没有出现热点，尝试长按按钮10秒恢复设置； ==默认密码是 fibonacci ==，==（IP:http://192.168.4.1 后台默认用户：admin，默认密码：fibonacci----自己改：admin，密码：admin888）==可在配置文件修改；进入管理页面，这里推荐使用chrome,其他浏览器不排除提示密码错误的问题。</p>
<p>接下来着重介绍一下固件里值得修改的选项
（关于配置环境的问题，可以参阅固件作者写的文档，arduino弄起来比较简单但是我一直没有成功才不得不换用PlatformIO。）</p>
<p>修改刷机后的默认设置
传感器针脚设置
传感器防抖动
DHT22 的小数位数
接入多个传感器（温湿度、光照、人体、物理开关）
禁用好心办坏事的崩溃检测</p>
<p>下面从文件入手介绍各个可修改的项目。（前面为设置项，后面是推荐修改为的值，不是原来的值）</p>
<ol>
<li>defaults.h</li>
</ol>
<p>只有一处建议修改：这是设置默认指示灯状态为“继电器状态”，相信大多数人都会使用这种模式吧。</p>
<pre><code class="c">#define LED1_MODE           LED_MODE_FOLLOW
</code></pre>

<ol>
<li>general.h</li>
</ol>
<p>(1)默认管理员密码。不受强密码规则限制。注意：如果这里设置少于8位，平时使用没有问题，但是开关处在热点模式时，连接密码也是这个，所以开关就连不上了。</p>
<pre><code class="c">#define ADMIN_PASS              &quot;fibonacci&quot;
</code></pre>

<p>(2)首次登录不强制修改密码。</p>
<pre><code class="c">#define WEB_FORCE_PASS_CHANGE   0
</code></pre>

<p>(3)禁用系统崩溃检查。以免系统开启自我保护模式，禁用大部分功能，导致必须重置。</p>
<pre><code class="c">#define SYSTEM_CHECK_ENABLED    0
</code></pre>

<p>(4)自动连接WiFi。</p>
<pre><code class="c">#define WIFI1_SSID              &quot;wuxianwang&quot;
#define WIFI1_PASS              &quot;mimamima&quot;
</code></pre>

<p>(5)设置中国时区。</p>
<pre><code class="c">#define NTP_TIME_OFFSET         8
</code></pre>

<ol>
<li>sensors.h</li>
</ol>
<p>接下来还有一些重要设置，这些设置决定了编译完成的固件所支持的传感器类型。</p>
<p>首先请搜索“_SUPPORT”，找到你需要接入的传感器，把后面的数字改为 1！</p>
<p>例如，要接入光线传感器，则为：</p>
<pre><code class="c">#define BH1750_SUPPORT                  1
</code></pre>

<p>并不是只能接一个，只要针脚够用，想接几个接几个！为了避免针脚冲突，在相应传感器的 SUPPORT 项下面，会有 PIN 设置，设置传感器的针脚。</p>
<p>(1)</p>
<pre><code class="c">#define SENSOR_READ_INTERVAL                6               // 默认的读取间隔
#define SENSOR_READ_MIN_INTERVAL            0               // 最小的读取间隔（可以通过TELNET和审查元素修改）
#define SENSOR_READ_MAX_INTERVAL            3600            // 最大的读取间隔
</code></pre>

<p>(2)</p>
<pre><code class="c">#define TEMPERATURE_MIN_CHANGE              0.0            

#define HUMIDITY_MIN_CHANGE                 0.2               
</code></pre>

<p>温度和湿度的上报最小改变值，在此范围内变化时不会上报数据，防止数据抖动。</p></div>
            </div>
        </div>

        <footer class="col-md-12">
            <hr>
            <p>Documentation built with <a href="https://www.mkdocs.org/">MkDocs</a>.</p>
        </footer>
        <script>
            var base_url = "../..",
                shortcuts = {"help": 191, "next": 78, "previous": 80, "search": 83};
        </script>
        <script src="../../js/base.js" defer></script>
        <script src="../../search/main.js" defer></script>

        <div class="modal" id="mkdocs_search_modal" tabindex="-1" role="dialog" aria-labelledby="searchModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-lg">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="searchModalLabel">Search</h4>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
                <p>
                    From here you can search these documents. Enter
                    your search terms below.
                </p>
                <form>
                    <div class="form-group">
                        <input type="search" class="form-control" placeholder="Search..." id="mkdocs-search-query" title="Type search term here">
                    </div>
                </form>
                <div id="mkdocs-search-results"></div>
            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div><div class="modal" id="mkdocs_keyboard_modal" tabindex="-1" role="dialog" aria-labelledby="keyboardModalLabel" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <h4 class="modal-title" id="keyboardModalLabel">Keyboard Shortcuts</h4>
                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>
            </div>
            <div class="modal-body">
              <table class="table">
                <thead>
                  <tr>
                    <th style="width: 20%;">Keys</th>
                    <th>Action</th>
                  </tr>
                </thead>
                <tbody>
                  <tr>
                    <td class="help shortcut"><kbd>?</kbd></td>
                    <td>Open this help</td>
                  </tr>
                  <tr>
                    <td class="next shortcut"><kbd>n</kbd></td>
                    <td>Next page</td>
                  </tr>
                  <tr>
                    <td class="prev shortcut"><kbd>p</kbd></td>
                    <td>Previous page</td>
                  </tr>
                  <tr>
                    <td class="search shortcut"><kbd>s</kbd></td>
                    <td>Search</td>
                  </tr>
                </tbody>
              </table>
            </div>
            <div class="modal-footer">
            </div>
        </div>
    </div>
</div>

    </body>
</html>
